import {Component, ElementRef, OnInit, Renderer2, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {DialogService} from "../../../service/dialogService";
import {CCRiskControllerService} from "../../../service/CCRiskController";
import {RestRiskExecution} from "../../../entity/RestRiskExecution";

@Component({
  selector: 'app-risk-check-execution-detail',
  templateUrl: './risk-check-execution-detail.component.html',
  styleUrls: ['./risk-check-execution-detail.component.css']
})
export class RiskCheckExecutionDetailComponent implements OnInit {

  riskExecutionId: number;
  restRiskExecution: RestRiskExecution = new RestRiskExecution();

  constructor(protected a_router: Router, public element: ElementRef, private renderer: Renderer2,
              public route: ActivatedRoute, public _dialogService: DialogService, public riskService: CCRiskControllerService) {
    this.route.params.subscribe(params => {
      this.riskExecutionId = +params['id'];
    });
  }

  ngOnInit() {
    this.setup();
  }

  setup() {
    this.riskService.riskCheckExecutionDetail(this.riskExecutionId).subscribe(
      (res) => {
        this.restRiskExecution = res;
      }
    );
  }

  detail(report) {
    // this.a_router.navigate(["/dashboard/report", reportId, "detail"]);
    this.a_router.navigate(["/dashboard/execution", this.riskExecutionId, report.subCategory.id, "report", report.id, "detail", "finish"]);
  }

}
